import { get, post, put, del } from '@/utils/request';
import type { GetPlansParams, CreatePlanData, UpdatePlanData } from './type';

/**
 * 套餐管理 API
 */

export const getPlans = (params: GetPlansParams) => {
  return get<any>('/plans', params as any);
};

export const getPlanById = (id: string) => {
  return get<any>(`/plans/${id}`);
};

export const createPlan = (data: CreatePlanData) => {
  return post<any>('/plans', data);
};

export const updatePlan = (data: UpdatePlanData) => {
  const { id, ...rest } = data;
  return put<any>(`/plans/${id}`, rest);
};

export const deletePlan = (id: string) => {
  return del(`/plans/${id}`);
};

